//
//  AWProtocol.m
//  AtWork2
//
//  Created by lucas on 15/4/22.
//  Copyright (c) 2015年 Foreveross. All rights reserved.
//

#import "AWProtocol.h"

const UInt8 AWProtocolConnectType = 1;
const UInt8 AWProtocolConnectAckType = 2;
const UInt8 AWProtocolConnectRstType = 3;
const UInt8 AWProtocolPingType = 4;
const UInt8 AWProtocolPongType = 5;
const UInt8 AWProtocolPostType = 6;
const UInt8 AWProtocolDisConnectType = 15;

@implementation AWProtocol

+ (instancetype)protocolWithType:(UInt8)type
                             qos:(UInt8)qos
                      digestSize:(UInt8)digestSize
                          digest:(UInt8)digest
                        bodySize:(UInt16)bodySize
                            body:(NSData *)body {
    
    return [[self alloc] initWithType:type qos:qos digestSize:digestSize digest:digest bodySize:bodySize body:body];
}

- (instancetype)initWithType:(UInt8)type
                         qos:(UInt8)qos
                  digestSize:(UInt8)digestSize
                      digest:(UInt8)digest
                    bodySize:(UInt16)bodySize
                        body:(NSData *)body {
    
    if (self = [super init]) {
        _type = type;
        _qos = qos;
        _digestSize = digestSize;
        _digest = digest;
        _bodySize = bodySize;
        _body = body;
    }
    return self;
}
@end
